"""
@File    :   execution_timer.py
@Time    :   2024/02/12 09:12:32
@Author  :   Qrj
@Email   :   923207736@qq.com
@description   :   计算执行时间相关方法
"""

import time
from functools import wraps


def execution_timer(func):
    """计算函数执行时间的装饰器"""

    @wraps(func)
    def wrapper(*args, **kwargs):
        start_time = time.perf_counter()
        result = func(*args, **kwargs)
        end_time = time.perf_counter()
        print(f"函数{func.__name__}的执行时间为: {end_time-start_time} 秒")
        return result

    return wrapper
